package main;

import Thread.Keeper;
import Thread.ThreadForFill;
import Thread.ThreadForFillRunnable;
import Thread.ThreadForRead;
import Thread.ThreadForReadRunnable;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import vectors.*;

public class Main {

    public static double method(double m) {
        return 1.0 + 2.0;

    }

    public static void main(String[] args) throws CloneNotSupportedException, FileNotFoundException, IOException, ClassNotFoundException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
        if (args.length == 3) {
            try {
                Class c = Class.forName(args[0]);
                Method m = c.getMethod(args[1], new Class[]{Double.TYPE});
                Double val = Double.valueOf(args[2]);
                Object res = m.invoke(null, new Object[]{val});
                System.out.println(res.toString());
            } catch (ClassNotFoundException e) {
                System.out.println("Класс не найден");
            } catch (NoSuchMethodException e) {
                System.out.println("Метод не найден");
            } catch (IllegalAccessException e) {
                System.out.println("Метод недоступен");
            } catch (InvocationTargetException e) {
                System.out.println("При вызове возникло исключение");
            }
            VectorIn vec = Vectors.createInstance(4, new ArrayVector());
            Class cl = vec.getClass();
            System.out.println(cl.getName());
}




//        VectorIn vec = new ArrayVector(4);
//        for (int i = 0; i < 4; i++) {
//            vec.setElement(i, i);
//        }
//       // File f = new File("D:\hard\progr\java\netbeans\nc-training-center-repo\students\versanov\Vectors\1.txt");
//        //OutputStream ou = new OutputStream(new FileOutputStream(file));
//        Vectors.writeVector(vec, null);


    }
}